Skip to content

Fix cryptic curl error in CLI E2E AspireStartAsync when dashboard URL is empty#16061

Open
Copilot wants to merge 7 commits intomainfrom
copilot/open-issue-failing-test
Open

Fix cryptic curl error in CLI E2E AspireStartAsync when dashboard URL is empty#16061
Copilot wants to merge 7 commits intomainfrom
copilot/open-issue-failing-test

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 11, 2026

Description

Fixes the cryptic curl: (3) URL rejected: Malformed input to a URL function error in CLI E2E tests by detecting an empty dashboard URL early and throwing a clear InvalidOperationException before the curl call.

Problem

The AspireStartAsync helper in CLI E2E tests extracts the dashboard URL from aspire start --format json output using sed. When the extraction fails (the dashboardUrl field is missing or in an unexpected format), $DASHBOARD_URL is empty. The existing code has an if [ -z "$DASHBOARD_URL" ] guard that dumps diagnostic logs when the URL is empty, but then falls through to the curl call with the empty URL, producing the cryptic error:

curl: (3) URL rejected: Malformed input to a URL function

This pattern was seen in: https://github.com/microsoft/aspire/actions/runs/24276013064/job/70890264300?pr=16059

Fix

Instead of falling through to curl after detecting the empty URL, the code now:

  1. Watches for the dashboard-url-empty echo marker in the terminal output (from the existing empty-URL guard)
  2. Continues waiting for the shell prompt so all diagnostic output (cat, ls -lt, tail) is fully captured in the terminal recording
  3. Throws an InvalidOperationException with a clear message explaining that the dashboard URL extraction failed
  4. Only proceeds to the curl verification if the URL was successfully extracted

This makes failures due to empty dashboard URLs produce clear, actionable error messages with full diagnostic context, instead of the cryptic curl error.

Validation

  • Verified the test project builds successfully
  • The change only affects the failure path (empty URL), so the happy path is unchanged

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

Copilot AI and others added 2 commits April 11, 2026 07:10
When $DASHBOARD_URL extraction from aspire start JSON output fails,
the curl call receives an empty string and produces a cryptic error:
  curl: (3) URL rejected: Malformed input to a URL function

This change detects the empty URL via the existing "dashboard-url-empty"
echo and throws a clear InvalidOperationException with diagnostic guidance,
instead of falling through to the curl call.

Fixes the failure pattern seen in:
https://github.com/microsoft/aspire/actions/runs/24276013064/job/70890264300

Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/750205bd-83b5-4cca-bfe1-65c59cd74ca8

Co-authored-by: radical <1472+radical@users.noreply.github.com>
@radical
Copy link
Copy Markdown
Member

radical commented Apr 11, 2026

/create-issue --test "Aspire.Cli.EndToEnd.Tests.PythonReactTemplateTests.CreateAndRunPythonReactProject" --url https://github.com/microsoft/aspire/actions/runs/24276013064/job/70890264300?pr=16059

Copilot AI requested a review from radical April 11, 2026 07:13
@github-actions
Copy link
Copy Markdown
Contributor

✅ Created failing-test issue #16062: #16062

To disable this test on your PR, comment:

/disable-test Aspire.Cli.EndToEnd.Tests.PythonReactTemplateTests.CreateAndRunPythonReactProject https://github.com/microsoft/aspire/issues/16062

@radical radical marked this pull request as ready for review April 11, 2026 07:16
@radical radical requested review from Copilot and mitchdenny April 11, 2026 07:16
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 11, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16061

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16061"

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves failure diagnostics in the CLI E2E test harness by turning an empty dashboard URL (caused by failed JSON extraction) into a clear, actionable exception instead of a cryptic curl error.

Changes:

  • Detects the dashboard-url-empty marker and throws a clear InvalidOperationException before attempting the curl verification.
  • Updates the empty-dashboard-URL guard comment to reflect the new fail-fast behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/Aspire.Cli.EndToEnd.Tests/Helpers/CliE2EAutomatorHelpers.cs Adds fail-fast detection for empty dashboard URL extraction to avoid cryptic curl failures.
tests/Aspire.Cli.EndToEnd.Tests/PythonReactTemplateTests.cs No functional change (whitespace).

Copy link
Copy Markdown
Member

@JamesNK JamesNK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found (bug): early return from WaitUntilAsync races with diagnostic output capture.

@radical
Copy link
Copy Markdown
Member

radical commented Apr 14, 2026

/create-issue Aspire.Cli.EndToEnd.Tests.PlaywrightCliInstallTests.AgentInit_WhenCwdDiffersFromWorkspaceRoot_PlacesSkillFilesInWorkspaceRoot https://github.com/microsoft/aspire/actions/runs/24378739594

Remove `return true` so the WaitUntilAsync predicate continues
waiting for the shell prompt after setting the dashboardUrlEmpty
flag, ensuring all diagnostic output is captured before throwing.

Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/45bf6bc5-0c92-4296-95ed-7cfa235e9dbb

Co-authored-by: radical <1472+radical@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 14, 2026

1 issue found (bug): early return from WaitUntilAsync races with diagnostic output capture.

Fixed in 13d6dc8 — removed the early return true so the predicate waits for the shell prompt after setting the flag, ensuring diagnostic output is fully captured before throwing.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dnceng.pkgs.visualstudio.com
    • Triggering command: /usr/share/dotnet/dotnet dotnet build tests/Aspire.Cli.EndToEnd.Tests/Aspire.Cli.EndToEnd.Tests.csproj /p:SkipNativeBuild=true -tl:off -v:q (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@github-actions
Copy link
Copy Markdown
Contributor

❌ Run 24378739594 belongs to workflow 'Outerloop Tests', not 'CI'.

@github-actions
Copy link
Copy Markdown
Contributor

❌ The /create-issue command failed. See the workflow run for details.

@radical radical requested a review from JamesNK April 14, 2026 17:26
radical and others added 3 commits April 14, 2026 15:53
The CellPatternSearcher was matching 'dashboard-url-empty' in the typed
command text (echo 'dashboard-url-empty') rather than in actual shell
output, causing the test to always think the URL was empty.

Replace with a separate echo command using variable expansion so the
typed text (${DASHBOARD_URL}) differs from the expanded output. The
pattern URLCHECK::URLEND only appears when the URL is truly empty.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@radical radical requested a review from IEvangelist April 14, 2026 20:41
@github-actions
Copy link
Copy Markdown
Contributor

🎬 CLI E2E Test Recordings — 71 recordings uploaded (commit 6fe3f5b)

View recordings
Test Recording
AddPackageInteractiveWhileAppHostRunningDetached ▶️ View Recording
AddPackageWhileAppHostRunningDetached ▶️ View Recording
AgentCommands_AllHelpOutputs_AreCorrect ▶️ View Recording
AgentInitCommand_DefaultSelection_InstallsSkillOnly ▶️ View Recording
AgentInitCommand_MigratesDeprecatedConfig ▶️ View Recording
AllPublishMethodsBuildDockerImages ▶️ View Recording
AspireAddPackageVersionToDirectoryPackagesProps ▶️ View Recording
AspireUpdateRemovesAppHostPackageVersionFromDirectoryPackagesProps ▶️ View Recording
Banner_DisplayedOnFirstRun ▶️ View Recording
Banner_DisplayedWithExplicitFlag ▶️ View Recording
Banner_NotDisplayedWithNoLogoFlag ▶️ View Recording
CertificatesClean_RemovesCertificates ▶️ View Recording
CertificatesTrust_WithNoCert_CreatesAndTrustsCertificate ▶️ View Recording
CertificatesTrust_WithUntrustedCert_TrustsCertificate ▶️ View Recording
ConfigSetGet_CreatesNestedJsonFormat ▶️ View Recording
CreateAndRunAspireStarterProject ▶️ View Recording
CreateAndRunAspireStarterProjectWithBundle ▶️ View Recording
CreateAndRunEmptyAppHostProject ▶️ View Recording
CreateAndRunJavaEmptyAppHostProject ▶️ View Recording
CreateAndRunJsReactProject ▶️ View Recording
CreateAndRunPythonReactProject ▶️ View Recording
CreateAndRunTypeScriptEmptyAppHostProject ▶️ View Recording
CreateAndRunTypeScriptStarterProject ▶️ View Recording
CreateJavaAppHostWithViteApp ▶️ View Recording
CreateStartAndStopAspireProject ▶️ View Recording
CreateTypeScriptAppHostWithViteApp ▶️ View Recording
DashboardRunWithOtelTracesReturnsNoTraces ▶️ View Recording
DeployK8sBasicApiService ▶️ View Recording
DeployK8sWithGarnet ▶️ View Recording
DeployK8sWithMongoDB ▶️ View Recording
DeployK8sWithMySql ▶️ View Recording
DeployK8sWithPostgres ▶️ View Recording
DeployK8sWithRabbitMQ ▶️ View Recording
DeployK8sWithRedis ▶️ View Recording
DeployK8sWithSqlServer ▶️ View Recording
DeployK8sWithValkey ▶️ View Recording
DeployTypeScriptAppToKubernetes ▶️ View Recording
DescribeCommandResolvesReplicaNames ▶️ View Recording
DescribeCommandShowsRunningResources ▶️ View Recording
DetachFormatJsonProducesValidJson ▶️ View Recording
DoListStepsShowsPipelineSteps ▶️ View Recording
DoctorCommand_DetectsDeprecatedAgentConfig ▶️ View Recording
DoctorCommand_WithSslCertDir_ShowsTrusted ▶️ View Recording
DoctorCommand_WithoutSslCertDir_ShowsPartiallyTrusted ▶️ View Recording
GlobalMigration_HandlesCommentsAndTrailingCommas ▶️ View Recording
GlobalMigration_HandlesMalformedLegacyJson ▶️ View Recording
GlobalMigration_PreservesAllValueTypes ▶️ View Recording
GlobalMigration_SkipsWhenNewConfigExists ▶️ View Recording
GlobalSettings_MigratedFromLegacyFormat ▶️ View Recording
InitTypeScriptAppHost_AugmentsExistingViteRepoAtRoot ▶️ View Recording
InvalidAppHostPathWithComments_IsHealedOnRun ▶️ View Recording
LegacySettingsMigration_AdjustsRelativeAppHostPath ▶️ View Recording
LogsCommandShowsResourceLogs ▶️ View Recording
OtelLogsReturnsStructuredLogsFromStarterApp ▶️ View Recording
PsCommandListsRunningAppHost ▶️ View Recording
PsFormatJsonOutputsOnlyJsonToStdout ▶️ View Recording
PublishWithConfigureEnvFileUpdatesEnvOutput ▶️ View Recording
PublishWithDockerComposeServiceCallbackSucceeds ▶️ View Recording
RestoreGeneratesSdkFiles ▶️ View Recording
RestoreSupportsConfigOnlyHelperPackageAndCrossPackageTypes ▶️ View Recording
RunFromParentDirectory_UsesExistingConfigNearAppHost ▶️ View Recording
SecretCrudOnDotNetAppHost ▶️ View Recording
SecretCrudOnTypeScriptAppHost ▶️ View Recording
StagingChannel_ConfigureAndVerifySettings_ThenSwitchChannels ▶️ View Recording
StartAndWaitForTypeScriptSqlServerAppHostWithNativeAssets ▶️ View Recording
StopAllAppHostsFromAppHostDirectory ▶️ View Recording
StopAllAppHostsFromUnrelatedDirectory ▶️ View Recording
StopNonInteractiveMultipleAppHostsShowsError ▶️ View Recording
StopNonInteractiveSingleAppHost ▶️ View Recording
StopWithNoRunningAppHostExitsSuccessfully ▶️ View Recording
UnAwaitedChainsCompileWithAutoResolvePromises ▶️ View Recording

📹 Recordings uploaded automatically from CI run #24421597840

@radical radical enabled auto-merge (squash) April 15, 2026 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants